<template>
    <el-button v-on="$listeners" :size="itemData.size" :style="itemData.style" :type="itemData.type" @click="btnClick">
        {{ itemData.title }}
    </el-button>
</template>

<script lang="ts">
import { Component, Vue, Watch, Prop } from "vue-property-decorator";
import { yzButtonAttribute } from '../../class/ui/yzButtonAttribute'
import { glEvent } from "@/events/glEvent";

@Component
export default class yzButton extends Vue {
    @Prop() itemData: yzButtonAttribute;
    glEvent = glEvent;

    btnClick() {
        this.$confirm("是否执行", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
        }).then(() => {
            console.log("开始请求订阅事件,itemData.name为:", this.itemData.name);
            this.itemData.name && glEvent.ui.emitEvent(this.itemData.name, this.itemData);
        })
    }
    mounted(this: any) { }

}
</script>

